package com.lekang.controller;

import com.lekang.dto.WxUserElderlyContractDTO;
import com.lekang.service.IWxUserElderlyContractService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;

/**
 * 微信用户-老人-合同关联查询控制器
 */
@RestController
@RequestMapping("/api/wx-user-elderly-contract")
public class WxUserElderlyContractController {

    @Resource
    private IWxUserElderlyContractService wxUserElderlyContractService;

    /**
     * 根据微信用户ID查询关联的老人及合同信息
     */
    @GetMapping("/list-by-wx-user")
    public List<WxUserElderlyContractDTO> getByWxUserId(@RequestParam Long wxUserId) {
        return wxUserElderlyContractService.listByWxUserId(wxUserId);
    }

    /**
     * 根据微信用户ID和合同状态查询
     */
    @GetMapping("/list-by-status")
    public List<WxUserElderlyContractDTO> getByStatus(
            @RequestParam Long wxUserId,
            @RequestParam String contractStatus) {
        return wxUserElderlyContractService.listByWxUserIdAndStatus(wxUserId, contractStatus);
    }
}